!
!  phfind     Recognizes point-like structures 
!
!  Copyright © 2010 - 2011 F.Hroch (hroch@physics.muni.cz)
!
!  This file is part of Munipack.
!
!  Munipack is free software: you can redistribute it and/or modify
!  it under the terms of the GNU General Public License as published by
!  the Free Software Foundation, either version 3 of the License, or
!  (at your option) any later version.
!  
!  Munipack is distributed in the hope that it will be useful,
!  but WITHOUT ANY WARRANTY; without even the implied warranty of
!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  GNU General Public License for more details.
!  
!  You should have received a copy of the GNU General Public License
!  along with Munipack.  If not, see <http://www.gnu.org/licenses/>.


program phfind

  use ifits

  implicit none
  character(len=1024) :: sb
  real :: lothresh = 7.0
  real :: threshold = 5.0
  real :: fwhm = 3.0
  real :: saturation = 6e4
  integer :: maxsky = 10000
  real :: shrplo = 0.2, shrphi = 1.0
  real :: rndlo = -1.0, rndhi = 1.0
  real :: readns = 1.0
  real :: phpadu = 1.0

  do
     read(*,*,end=20) sb

!     sb = 'x.fits'
     call ffind(sb,maxsky,saturation,fwhm,lothresh,threshold, &
          shrplo,shrphi,rndlo,rndhi,readns, phpadu)
!threshold,fwhm,maxsky,saturation)

  end do

20 continue

end program phfind




!subroutine finder(d,threshold,fwhm,maxsky,saturation,xcen,ycen)
!
!  use stat
!
!  implicit none
!  real, dimension(:,:),intent(in) :: d
!  real, intent(in) :: threshold,fwhm,saturation
!  real, dimension(:),allocatable,intent(out) :: xcen,ycen
!  integer :: nmax
!
!!  nmax = min(maxsky, (size(d,1)*size(d,2))/3)
!!  call daosky(d,nmax,saturation,sky,skysig)
!  call daofind(d,maxsky,saturation,fwhm,shrplo,shrphi,rndlo,rndhi,&
!       readns, phpadu,xcen,ycen)
!
!end subroutine finder
!
